package com.gable.exhibition.service.impl;

import com.gable.common.util.ReturnResultUtil;
import com.gable.exhibition.dao.ValidateCodeDao;
import com.gable.exhibition.model.ValidateCode;
import com.gable.exhibition.service.ValidateCodeService;
import com.gable.exhibition.util.MessageUtil;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Lesson on 2018/2/5.
 */
@Service("validateCodeService")
public class ValidateCodeServiceImpl implements ValidateCodeService {

    Logger logger = Logger.getLogger(this.getClass());

    @Autowired
    ValidateCodeDao validateCodeDao;


    @Override
    @Transactional(rollbackFor = RuntimeException.class)
    public ReturnResultUtil saveValidateCode(ValidateCode validateCode) {
        int result = validateCodeDao.insert(validateCode);
        if(result>0){
            return new ReturnResultUtil(200, MessageUtil.SENDSUCCESS);
        }
        return new ReturnResultUtil(500,MessageUtil.SENDFAIL);
    }
}
